#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>

int main(int argc, const char** argv)
{
    int btnState = 0;
    int fd = open("/dev/myBtnsDev", O_RDONLY);
    if(fd < 0)
    {
        perror("打开myBtns失败\n");
        return -1;
    }

    while(1)
    {
        read(fd,&btnState,sizeof(btnState));
        printf("btnState = %d\n",btnState);
        sleep(1);
    }
    close(fd);

    return 0;
}